package com.example.train.business.controller;

import com.example.train.business.req.Confirm_OrderDoReq;
import com.example.train.business.service.Confirm_OrderService;
import com.example.train.common.resp.CommonResp;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/confirm_Order")

public class Confirm_OrderController {

    @Resource
    private Confirm_OrderService confirm_OrderService;

    /**
     * 乘客注册请求的controller类，用于调用service
     * 注意PostMapping必须要用requestBody注解，否则后端接受不到数据
     * @param confirm_OrderSaveReq
     * @return
     */
    @PostMapping("/save")
    public CommonResp<Object> save(@Valid @RequestBody Confirm_OrderDoReq confirm_OrderSaveReq) {
        confirm_OrderService.save(confirm_OrderSaveReq);
        return new CommonResp<>();
    }
    @PostMapping("/do")
    public CommonResp<Object> doConfirm(@Valid @RequestBody Confirm_OrderDoReq req) {
        confirm_OrderService.doConfirm(req);
        return new CommonResp<>();
    }

}

